Ext.setup({
		icon: 'icon.png'
	,	tabletStartupScreen: 'tablet_startup.png'
	,	phoneStartupScreen: 'phone_startup.png'
	,	glossOnIcon: false
	,	onReady: function() {
			Ext.regModel('GeoInformation', {
				fields: [
						{name: 'lat', type: 'string'}
					,	{name: 'lon', type: 'string'}
					,	{name: 'genus', type: 'string'}
					,	{name: 'species', type: 'string'}
				]
			});

			Ext.regModel('Setting', {
				fields: [
						{name: 'fusionID', type: 'string'}
					,	{name: 'masterID', type: 'string'}
					,	{name: 'name', type: 'string'}
				]
			});
		
			var infoPanel = new BioBlitz.InfoPanel({
					title: "Info"
				,	html: '<div style="text-align:center; padding:44px;">Welcome to BioBlitz mobile version. To get started select any of the items below.</div>'
				,	dockedItems: [{
							xtype: 'toolbar'
						,	dock: 'top'
						,	title: 'BioBlitz'
					}]
			});
		
			var settingPanel = new BioBlitz.SettingPanel({
					title: "Settings"
				,	iconCls: 'settings'
			});
		
			var myMapPanel = new BioBlitz.FusionMapPanel ({
					title: "Local Map"
				,	lat: 41
				,	lon: -90
				,	zoom: 6
			});

			var masterMapPanel = new BioBlitz.FusionMapPanel ({
					title: "Master Map"
				,	lat: 41
				,	lon: -70
			});

//				,	fusion_id: localStorage.getItem('fusionid')
			
			if(Ext.is.iPad == true){
				var geoentrypanel = new BioBlitz.HybridPanel({
						lat: 41
					,	lon: -70
					,	zoom: 6
				});
			}else{
				var geoentrypanel = new BioBlitz.Phone.HybridPanel({
						lat: 41
					,	lon: -70
					,	zoom: 6
				});
			}
			
			var tabpanel = new Ext.TabPanel({
					fullscreen: true
				,	id: 'tabpanel'
				,	activeItem:0
				,	tabBar: {
							dock: 'bottom'
						,	defaults: {
									ui: 'light'
							}	
						,	layout: {
									pack: 'center'
							}
					}
				,	animation: {
							type: 'fade'
						,	cover: true
					}	
				,	items: [
							infoPanel
						,	geoentrypanel
						,	myMapPanel
						,	masterMapPanel
						,	settingPanel
					]
      });
		 
        if (Ext.is.Android) {
					tabpanel.items.unshift({
							xtype: 'component'
						,	styleHtmlContent: true
						,	html: '<span style="color: red">Forms on Android are currently under development. We are working hard to improve this in upcoming releases.</span>'
					});
        }
        
        if (Ext.is.Phone) {
            tabpanel.fullscreen = true;
        } else {
					Ext.apply(tabpanel, {
							autoRender: true
						,	floating: true
						,	modal: true
						,	centered: true
						,	hideOnMaskTap: false
						,	fullscreen:true
					});
        }

			myMapPanel.addFusionLayer( localStorage.getItem('fusionid') );

    }

});